﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Logging;
using Logging.Utils;
using Logging.Factory;

namespace LoggingTest
{
    [TestClass]
    public class UnitTestTXT
    {
        [TestInitialize]
        public void TestInit()
        {
            LoggingFactory.Dispose();
        }


        [TestMethod]
        public void TestMethodLogServiceTXT()
        {
            ILogService log = LoggingFactory.GetLogService(new ParamLog() { TypeLog = TypeLog.TXT, NameApplication = "BaseSMQ", PathApplication = @"C:\Users\legouellecs\Desktop" });
            Assert.IsNotNull(log);
        }

        [TestMethod]
        public void TestMethodLogTXT()
        {
            ILogService log = LoggingFactory.GetLogService(new ParamLog() { TypeLog = TypeLog.TXT, NameApplication = "BaseSMQ", PathApplication = @"C:\Users\legouellecs\Desktop" });

            LogTrace trace = new LogTrace
            {
                UtilisateurConnecte = "legouellecs",
                Niveau = LogLevel.Error,
                Identifiant = "legouellecs",
                Ecran = "LivraisonATF",
                DetailMessage = "TEST"
            };

            log.WriteLog(trace);

            LogTrace trace2 = new LogTrace
            {
                UtilisateurConnecte = "brigaudj",
                Niveau = LogLevel.Info,
                Identifiant = "brigaudj",
                Ecran = "LivraisonATF",
                DetailMessage = "TEST"
            };

            log.WriteLog(trace2);
        }
    }
}
